how to use socket to establish communication between client end and server end